//
//  KqScreenUtil.h
//  kq_flutter_widgets
//
//  Created by wtb on 2023/6/3.
//

#ifndef KqScreenUtil_h
#define KqScreenUtil_h

CG_INLINE double
ScreenWidth(){
    return [UIScreen mainScreen].bounds.size.width;
}

CG_INLINE double
ScreenHight(){
    return [UIScreen mainScreen].bounds.size.height;
}

CG_INLINE double
RateWidth(float w){
    return w * ScreenWidth() / 414.0;
}

CG_INLINE double
RateHeight(float w){
    return w * ScreenHight() / 736.0;
}

// 状态栏高度
CG_INLINE CGFloat
StatusBarHeight(){
    CGFloat statusHeight = 20;
    if (@available(iOS 13.0, *)) {
      UIStatusBarManager *statusBarManager = [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager;
        
        statusHeight = statusBarManager.statusBarFrame.size.height;
    }else {
        statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
    }
    if(statusHeight >= 20){
        return statusHeight;
    }
    if(ScreenHight() < 800
       ||
       (ScreenWidth() == 414 && ScreenHight() == 736)
       ||
       (ScreenWidth() == 476 && ScreenHight() == 847)){
        return 20;
    }
    return 48;
}
#endif /* KqScreenUtil_h */
